﻿CREATE PROCEDURE [dbo].[yaf_userpmessage_list](
                @UserPMessageID INT)
AS
    BEGIN
        SELECT a.*,
               FromUser = b.Name,
               ToUserID = c.UserID,
               ToUser = c.Name,
               d.IsRead,
               d.UserPMessageID
        FROM   yaf_PMessage a,
               yaf_User b,
               yaf_User c,
               yaf_UserPMessage d
        WHERE  b.UserID = a.FromUserID
        AND c.UserID = d.UserID
        AND d.PMessageID = a.PMessageID
        AND d.UserPMessageID = @UserPMessageID
    END


